﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using mal.balades.Business.Manager;

namespace mal.balades.Business.Web
{
    public class BaladesManagerProxy
    {

        private const string BaladesManagerProxyKey = "BaladesManager";

        public static BaladesManager Instance
        {
            get
            {
                //return new BaladesManager();
                if (HttpContext.Current == null || HttpContext.Current.Session == null)
                {
                    return new BaladesManager();
                }
                else
                {

                    if (HttpContext.Current.Session[BaladesManagerProxyKey] != null)
                    {
                        return (BaladesManager)HttpContext.Current.Session[BaladesManagerProxyKey];
                    }
                    else
                    {
                        HttpContext.Current.Session[BaladesManagerProxyKey] = new BaladesManager();
                        return (BaladesManager)HttpContext.Current.Session[BaladesManagerProxyKey];
                    }
                }
            }
        }
    }
}